// const { DataTypes } = require("sequelize");
// const sequelize = require("../db/index.js");

// module.exports = SystemUser;

module.exports = function (sequelize, DataTypes) {
  return sequelize.define(
    "system_user",
    {
      id: {
        autoIncrement: true,
        type: DataTypes.INTEGER,
        allowNull: false,
        primaryKey: true,
        comment: "主键",
        field: "id",
      },
      uuid: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4, // 或 DataTypes.UUIDV1
        comment: 'uuid',
        field: 'uuid'
      },
      name: {
        type: DataTypes.STRING(50),
        allowNull: true,
        comment: "用户名",
        field: "name",
      },
      nickName: {
        type: DataTypes.STRING(50),
        allowNull: true,
        comment: "昵称",
        field: "nickName",
      },
      department: {
        type: DataTypes.STRING(50),
        allowNull: true,
        comment: "部门",
        field: "class",
      },
      birthday: {
        type: DataTypes.DATEONLY,
        allowNull: true,
        comment: "生日",
        field: "birthday",
      },
      sex: {
        type: DataTypes.STRING(20),
        allowNull: true,
        comment: "性别",
        field: "sex",
      },
      avatar: {
        type: DataTypes.STRING(500),
        allowNull: true,
        comment: "头像",
        field: "avatar",
      },
      loginId: {
        type: DataTypes.STRING(64),
        allowNull: true,
        comment: "登录账号",
        field: "loginId",
      },
      password: {
        type: DataTypes.STRING(64),
        allowNull: true,
        comment: "密码",
        defaultValue: "123456",
        field: "password",
      },
    },

    {
      sequelize,
      tableName: "system_user",
      timestamps: true,
      paranoid: true,
      createdAt: "createTime",
      updatedAt: "updateTime",
      deletedAt: "deleteTime",
    }
  );
};
